home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / cnet / viewlog.lha / viewlog5 / VL_Maint < prev    next >
Text File  |  1996-11-03  |  14KB  |  296 lines

  1. /**************************************************************************\
  2.              $VER: ViewLog Maint, v5.01 (3-Nov-96) by Dotoran!
  3. \**************************************************************************/
  4. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  5. tr=transmit ; se=sendstring ; gc=getchar ; gu=getuser ; mg=maygetchar
  6. a='rexxsupport.library';if ~show('l',a) then if ~addlib(a,0,-30) then exit
  7.  
  8. changewhere "ViewLog5 Maint" ; tw=0 ; ver="5.01"
  9. se "f138HcfHello...5HceViewLog5 c9Maint c6loading...cc"
  10.  
  11. BEGIN:
  12.   call READCONFIG ; call CHECKVER ; call READTITLES ; call READDATA
  13.   call SETUP ; call SCREEN
  14.  
  15. START:;rr=word(rows,row);cc=word(cols,col);inc=4;if ed=1 then do;rr=row+4;inc=15;end
  16.   if col~=2 then help=help.col ; else do ; z=lo+(row-1) ; a=trim.z ; help=res.a ; end
  17.   se "z2cf5H"center(help,52)"z0"rr";"cc"Ho1cf>o078H" ; gc ; call CHECK
  18.   k=result ; kk="" ; if c2d(k)=27 then do ; do 2 ; mg ; end ; kk=result ; end
  19.   if c2d(k)=13 then signal EDIT
  20.   if (c2d(k)=27 & kk="NOCHAR") | k="Q" then signal QUIT
  21.   if kk~="NOCHAR" & k~="" then tr ""rr";"cc"H "
  22.   if k=8 | kk="A" then do
  23.     row=row-1 ; if row<1 then row=hi2-lo+1 ; signal START ; end
  24.   if k=2 | kk="B" then do
  25.     row=row+1 ; if row>hi2-lo+1 then row=1
  26.     signal START ; end
  27.   if k=6 | kk="C" then do
  28.     col=col+1 ; if col>7 then col=1 ; signal START ; end
  29.   if k=4 | kk="D" then do
  30.     col=col-1 ; if col<1 then col=7 ; signal START ; end
  31.   if k="N" & hi<logs then do ; lo=lo+inc ; hi=hi+inc
  32.     if ed=2 then call DISPLAY1 ; else call DISPLAY2
  33.     if hi2=logs then row=1 ; signal START ; end
  34.   if k="P" & lo>1 then do ; lo=lo-inc ; hi=hi-inc
  35.     if ed=2 then call DISPLAY1 ; else call DISPLAY2 ; signal START ; end
  36.   if k="M" & ed=1 then do ; ed=2 ; row=1 ; col=1 ; lo=1 ; hi=4
  37.     if hi>logs then hi=logs ; call SCREEN ; signal START ; end
  38.   if k="L" & ed=2 then do ; ed=1 ; row=1 ; col=1 ; lo=1 ; hi=15
  39.     if hi>logs then hi=logs ; call SCREEN ; signal START ; end
  40.   if k="S" then do;call SCANDATA;signal BEGIN;end
  41.   if k="G" then do
  42.     se "5HcbGoto c6which cdpagec6? c7(cf1c6-cf"logs%inc"c6/cf[cb"logs%inc%2"cf]c7)c6: cfi64 2}"
  43.     gu 70;a=result;if a<1|a>logs%inc|datatype(a,'n')=0 then a=logs%inc%2
  44.  
  45.     lo=a*inc-inc+1 ; hi=lo+inc-1
  46.  
  47.     se "1H"
  48.     if ed=2 then call DISPLAY1 ; else call DISPLAY2 ; signal START;end
  49.  
  50.  signal START
  51.  
  52. EDIT:;it=lo+(row-1);z=1;if it/2=it%2&ed~=2 then z=2;a="EDIT"col;signal (a)
  53.  
  54. EDIT1:;se ""rr";"cc+1"Hc"substr("e6",z,1)"L1305640 #"uacc.it"}i4 18}75Hcf"
  55.   gu 70;a=result;if uacc.it=a then signal START
  56.   a=PARSE(a,0,31);a=RANGE(itt.0);uac.it=itt.0;uacc.it=a;save=1
  57.   tr ""rr";"cc+1"Hc"substr("e6",z,1)left(a,18)"75H ";signal START
  58.  
  59. EDIT2:;a=trim.it;a=a+1;if a=3 then a=1;trim.it=a;save=1
  60.   se ""rr";"cc+1"Hc"substr("91",z,1)left(word("Ask Auto",a),7)
  61.  signal START
  62.  
  63. EDIT3:;se ""rr";"cc+4"Hh3c"substr("f7",z,1)"L1305640 #"trln.it"}i4 3}"
  64.   gu 70;a=result;if a<5 then a=5 ; trln.it=a ; save=1
  65.   tr ""rr";"cc+1"Hc"substr("f7",z,1)right(a,3);signal START
  66.  
  67. EDIT4:;a=logH.it;a=a+1;if a>1 then a=0;logH.it=a;save=1
  68.   se ""rr";"cc+1"Hc"substr("a2",z,1)right(word("No Yes",a+1),3)
  69.   if a=0 then hisT.it="N/A" ; else hisT.it=trln.it*10
  70.   se ""rr";"cc+5"Hc"substr("e6",z,1)right(hisT.it,7);signal START
  71.  
  72. EDIT5:;se ""rr";"cc+5"Hh4c"substr("e6",z,1)"L1305640 #"hisT.it"}i4 4}"
  73.   gu 70;a=result;if a<0 then a=0 ; hisT.it=a ; save=1
  74.   tr ""rr";"cc+1"Hc"substr("e6",z,1)right(a,4);signal START
  75.  
  76. EDIT6:;aa=logI.it
  77.   se "1Hcc>cdL1305640 #"title.aa"}i4 78}1H"
  78.   gu 70;a=result;save=1;title.aa=a;zz=0;if a>"" then zz=1
  79.   tr ""rr";"cc+1"Hc"substr("d5",z,1)right(word("No Yes",zz+1),3)
  80.   if ed=2 then tr ""rr+1";3Hcd"left(a,76)
  81.  signal START
  82.  
  83. EDIT7:;a=sysM.it;a=a+1;if a>1 then a=0;sysM.it=a;save=1
  84.   se ""rr";"cc+1"Hc"substr("91",z,1)right(word("No Yes",a+1),3)
  85.  signal START
  86.  
  87. QUIT:
  88.   if save=1 then do;call SAVEDATA;call SAVETITLES;end;se "1H"
  89.  exit
  90.  
  91. SAVEDATA:
  92.   se "5HcbSaving cddata filesc6...c9"
  93.   call open(f1,comP"VL_Data","w")
  94.     do i=1 to logs ; se TWIRL()
  95.       log.i=left(logI.i,4)left(logN.i,15)left(logF.i,15)left(uacc.i,15)
  96.       log.i=log.i||left(uac.i,90)left(trim.i,2)left(trln.i,3)
  97.       log.i=log.i||left(logH.i,2)left(hisT.i,4)left(sysM.i,2)asoc.i
  98.       call writeln(f1,log.i)
  99.     end i
  100.   call close(f1)
  101.   address command "sort "comP"VL_Data "comP"VL_Data COLSTART 5"
  102.  return
  103.  
  104. SAVETITLES:
  105.   call open(f1,comP"VL_Titles","w")
  106.     do i=1 to logs ; z=logI.i ; se TWIRL()
  107.       call writeln(f1,left(logI.i,4)left(logN.i,12)title.z)
  108.     end i
  109.   call close(f1)
  110.  return
  111.  
  112. SCREEN:;a="SCREEN"ed;signal (a)
  113. SCREEN1:;tr "f1@4       ViewLog, v"ver" Maintenance Module by Dotoran of Frontiers BBS!         "
  114.   tr "ÉÍÍËÍÍÍËÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍËÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍÍËÍÍÍÍÍÍÍ»"
  115.   tr "º##ºID#ºLog Name ºUser Access GroupsºReStartº TrimºHistºHistoryºHeaderº Masterº"
  116.   tr "ÌÍÍÊÍÍÍÊÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÊÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÍÊÍÍÍÍÍÍ͹"
  117.   do i=1 to 15;tr "ºCº";end i;tr "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍNEXTÍÍPASTÍÍSCANÍ͹"
  118.   tr "ºUse Arrows to Move<ENTERto Edit<ESCto Save/QuitÄorÄÅÄÄÄÄÄÅÄÄÄÄÄ´Cº"
  119.   tr "ÈÄ>                                                    <ÄÏÍÍGOTOÍÍMOREÍÍLESS<ļ";signal DISPLAY2
  120. SCREEN2:;tr "f1@4       ViewLog, v"ver" Maintenance Module by Dotoran of Frontiers BBS!         "
  121.   tr "ÉÍÍËÍÍÍËÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍËÍÍÍÍËÍÍÍÍÍÍÍËÍÍÍÍÍÍËÍÍÍÍÍÍÍ»"
  122.   tr "º##ºID#ºLog Name ºUser Access GroupsºReStartº TrimºHistºHistoryºHeaderº Masterº"
  123.   tr "ÌÍÍÊÍÍÍÊÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÊÍÍÍÍÊÍÍÍÍÍÍÍÊÍÍÍÍÍÍÊÍÍÍÍÍÍ͹"
  124.   do i=1 to 3;tr "ºCº";tr "ºCº";tr "ºCº";tr "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹";end i
  125.   tr "ºCº";tr "ºCº";tr "ºCº";tr "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍNEXTÍÍPASTÍÍSCANÍ͹"
  126.   tr "ºUse Arrows to Move<ENTERto Edit<ESCto Save/QuitÄorÄÅÄÄÄÄÄÅÄÄÄÄÄ´Cº"
  127.   tr "ÈÄ>                                                    <ÄÏÍÍGOTOÍÍMOREÍÍLESS<ļ";signal DISPLAY1
  128.  
  129. DISPLAY1: ; ro=1 ; hi2=hi ; if hi>logs then hi2=logs
  130.   do i=lo to hi2 ; r=ro*4+1
  131.     se "cf"r";2H"right(i,2)" cb"logI.i" ca"left(logF.i,9)" ce"
  132.     se left(uacc.i,20)" c9"left(word("Ask Auto",trim.i),5)
  133.     se " cf"right(trln.i,5)" ca"right(word("No Yes",logH.i+1),4)" ce"
  134.     if logH.i=1 then se right(hisT.i,7)"cd" ; else se right("N/A",7)"cd"
  135.     a=0;z=logI.i;if title.z>"" then a=1
  136.     tr right(word("No Yes",a+1),7)" c9"right(word("No Yes",sysM.i+1),7)
  137.     tr ""r+1";3Hcd"left(title.z,76) ; tr ""r+2";3Hc9"left(asoc.i,76)
  138.     ro=ro+1
  139.   end i
  140.   if hi2=logs then do
  141.     do i=hi2-lo to inc-2 ; r=ro*4+1
  142.       tr ""r";2H"left(" ",77)""r+1";2H"left(" ",77)
  143.       tr ""r+2";2H"left(" ",77) ; ro=ro+1
  144.     end i ; end
  145.  return
  146.  
  147. DISPLAY2: ; ro=1 ; hi2=hi ; if hi>logs then hi2=logs
  148.   do i=lo to hi2 ; r=ro+4 ; c=1 ; if i/2=i%2 then c=2
  149.     se "c"substr("f7",c,1)""r";2H"right(i,2)" c"substr("b3",c,1)logI.i
  150.     se " c"substr("a2",c,1)left(logF.i,9)" c"substr("e6",c,1)left(uacc.i,20)
  151.     se " c"substr("91",c,1)left(word("Ask Auto",trim.i),5)
  152.     se " c"substr("f7",c,1)right(trln.i,5)" c"substr("a2",c,1)right(word("No Yes",logH.i+1),4)
  153.     if logH.i=1 then se " c"substr("e6",c,1)right(hisT.i,7)" c"substr("d5",c,1)
  154.       else se " c"substr("e6",c,1)"    N/A c"substr("d5",c,1)
  155.     a=0;z=logI.i;if title.z>"" then a=1
  156.     se right(word("No Yes",a+1),6)" c"substr("91",c,1)right(word("No Yes",sysM.i+1),7);ro=ro+1
  157.   end i
  158.   if hi2=logs then do
  159.     do i=hi2-lo to inc-2
  160.       tr ""i+6";2H"left(" ",77)
  161.     end i ; end
  162.  return
  163.  
  164. SETUP: ; ed=1 ; it=1 ; lo=1 ; hi=15 ; tw=0 ; if hi>logs then hi=logs
  165.   help.1="The Access Group RANGE that can VIEW this log file."
  166.   help.3="The number of Lines to Trim this Log file down to."
  167.   help.4="Should a history of this log be created/maintained."
  168.   help.5="The number of Lines that a History file can become."
  169.   help.6="The title text to use when displaying this log."
  170.   help.7="Is this a MASTER SYSOP(ID#1) ONLY editable log."
  171.   res.1="Ask Maint User to Trim or Delete Logs & Histories."
  172.   res.2="Automatically Trim Logs during AutoMaintenance."
  173.   row=1 ; col=1 ; rows="5 9 13 17" ; cols="18 39 47 52 59 67 75"
  174.  return
  175.  
  176. CHECKVER: ; if ver=vers then return
  177.   tr "f1n6c9Version Conflict:n1"
  178.   tr "   `ViewLog5.cfg' version: v"vers
  179.   tr "   `VL_Maint'     version: v"ver
  180.   tr "n1   BOTH files above need to be v"max(ver,vers)"!"
  181.   tr "n1Halting, due to conflicting versions..."
  182.  exit
  183.  
  184. READCONFIG:;gu 1311992;comP=result
  185.   call open(f1,comP"ViewLog5.cfg","r")
  186.     vers=readln(f1) ; macc=readln(f1)
  187.     uacc=readln(f1) ; trim=readln(f1) ; trln=readln(f1)
  188.     logH=readln(f1) ; hisP=readln(f1) ; hisT=readln(f1)
  189.     ETex=readln(f1)
  190.     ARus=readln(f1) ; ARsy=readln(f1) ; ARpt=readln(f1)
  191.   call close(f1)
  192.  return
  193.  
  194. READDATA:
  195.   if ~exists(comP"VL_Data") then call SCANDATA2
  196.   call open(f1,comP"VL_Data","r")
  197.     do i=1 until eof(f1) ; log.i=readln(f1) ; se TWIRL()
  198.       parse var log.i 1 logI.i . 5 logN.i . 20 logF.i . 35 uacc.i .,
  199.                       50 uac.i"  " 138 trim.i . 140 trln.i . 143 logH.i .,
  200.                       145 hisT.i . 149 sysM.i . 151 asoc.i
  201.     end i ; logs=i-1
  202.   call close(f1)
  203.  return
  204.  
  205. READTITLES:
  206.   call open(f1,comP"VL_Titles","r") ; title.=""
  207.     do i=1 until eof(f1) ; a=readln(f1) ; se TWIRL()
  208.       parse var a 1 v1 . 5 v2 . 17 v3 ; title.v1=v3 ; end i ; titles=i-1
  209.   call close(f1)
  210.  return
  211.  
  212. PARSE: ; arg rng,min,maxx
  213.    itt.='';c=0;itt=translate(rng,'  ','.,')
  214.     do a=1 to words(itt);c=c+1;itt.c=word(itt,a);se TWIRL()
  215.         if index(itt.c,'-')>0 then do;parse var itt.c x'-'y
  216.         if y='' then y=maxx;if x='' then x=min
  217.         if x>y then do;d=x;x=y;y=d;end
  218.         if x<min|y>maxx|~datatype(x,'W')|~datatype(y,'W') then do;c=c-1;iterate;end
  219.         do b=x to y;itt.c=b;c=c+1;end;c=c-1;end
  220.     else if itt.c<min|itt.c>maxx|~datatype(itt.c,'W') then do;c=c-1;iterate;end;end
  221.     if c>0 then do;do a=1 to c-1;d=a;do b=a+1 to c;d=d+1;se TWIRL()
  222.         if itt.d<itt.a then do;y=itt.a;itt.a=itt.d;itt.d=y;end
  223.         else if itt.d=itt.a then do;itt.d=itt.c;c=c-1;d=d-1;end;end;end;end;a=0
  224.     do i=1 to c;se TWIRL();j=i+1;if itt.i~=itt.j then do;a=a+1;itt.a=itt.i;end;end;c=a
  225.     do i=1 to c;se TWIRL();itt.0=itt.0||itt.i' ';end
  226.   return itt.0
  227.  
  228. RANGE:;arg gr;a="";if words(gr)=1 then return strip(gr)
  229.   do i=1 to words(gr) ; se TWIRL()
  230.     j=i+1 ; v1=word(gr,i) ; v2=word(gr,j)
  231.     if v2>"" then if v2-v1=1 then do ; s=v1
  232.       do while v2-v1=1
  233.         i=i+1 ; j=j+1 ; v1=word(gr,i) ; v2=word(gr,j)
  234.         if v2="" then leave
  235.       end
  236.       a=a||s"-"v1"," ; iterate i
  237.     end
  238.     if v2="" then a=a||v1","
  239.   end i
  240.  return strip(a,'t',',')
  241.  
  242. TWIRL:;sh="--\\||//";tw=tw+1;if tw>8 then tw=1;return substr(sh,tw,1)"<1"
  243.  
  244. SCANDATA: ; se "5HcbScan c6memory for cddefined logsc6? c7[caYesc7]c9: ";gc;a=result
  245.   if a="N" then do;se "c9Noc6.1H";signal START;end;else se "caYesc6!"
  246. SCANDATA2: ; se "5Hc6Scanning caInternal Logsc6...c9" ; logs=0 ; l=""
  247.   do i=1 to 88 ; v=2321898+(i*24) ; se TWIRL()
  248.     gu v ; v1=result ; gu v+12 ; v2=result ; gu (v+10)-100000 ; v3=result
  249.     if v2>"" then do ; logs=logs+1 ; logI.logs=v3 ; logN.logs=v1
  250.       logF.logs=v2 ; l=l||v2" " ; end ; end i
  251.   if open(f1,comP"VL_Data2","r") then do
  252.     id=readln(f1)
  253.     do i=1 until eof(f1)
  254.       a=readln(f1) ; l=l||a" "
  255.     end i
  256.     logs=logs+i-1
  257.     call close(f1)
  258.   end
  259.   else id=499
  260.   se "5Hc6Scanning cbExternal Logsc6...ca"
  261.   if ~exists(comP"VL_Data2") then do
  262.     call open(f1,comP"VL_Data2","w")
  263.       call writeln(f1,id) ; end
  264.   else call open(f1,comP"VL_Data2","a")
  265.   a=showdir("SysData:Log/","F"," ")
  266.   do i=1 to words(a) ; aa=word(a,i) ; se TWIRL()
  267.     if find(l,aa)=0 then do ; logs=logs+1 ; call writeln(f1,aa)
  268.       id=id+1 ; logI.logs=id ; logN.logs=aa ; logF.logs=aa ; end
  269.   end i ; call seek(f1,0,"b") ; call writech(f1,id) ; call close(f1)
  270.   se "5Hc6Creating cdLog Associationsc6...cb"
  271.   do i=1 to logs ; asoc.i=logN.i
  272.     do j=i+1 to logs ; se TWIRL()
  273.       if logF.i=logF.j then asoc.i=asoc.i" "logN.j ; end j ; end i
  274.   se "5Hc6Saving cf"comP"VL_Data c6files...ce"
  275.   call open(f1,comP"VL_Data","w") ; uac=PARSE(uacc,0,31)
  276.     do i=1 to logs ; se TWIRL()
  277.       log.i=left(logI.i,4)left(logN.i,15)left(logF.i,15)left(uacc,15)
  278.       log.i=log.i||left(uac,90)left(trim,2)left(trln,3)
  279.       log.i=log.i||left(logH,2)left(hisT,4)left("0",2)asoc.i
  280.       call writeln(f1,log.i)
  281.     end i ; call close(f1)
  282.   address command "sort "comP"VL_Data "comP"VL_Data COLSTART 5"
  283.   se "5Hc6Reloading c9data filesc6..."
  284.  return
  285.  
  286. CHECK:;if result~="###PANIC" then return result
  287.   a="Lost Carrier!";tr "1Hc9"a;logentry a;bufferflush;exit
  288.  
  289. SYNTAX:;ERROR:;IOERR:;e1=' Error: 'rc' ('errortext(rc)')'
  290.   e2='  Line: 'left(sigl,4)'File:';gu 1311992;a=result;gu 1311960
  291.   b=result;c='"'a||b'"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2
  292.   e=sourceline(sigl);do while e~='';e3='Source: 'left(e,37);tr e3
  293.   logentry e3;e=substr(e,38);end;bufferflush;exit
  294. /**************************************************************************\
  295. \****************************************** Frontiers BBS (716)/823-9892 **/
  296.